"use strict";

/**
 * Config for the router
 */
angular.module("app").config([ "$routeProvider", function($routeProvider) {

	$routeProvider.when("/server/list", {
		templateUrl : "/server/list.tpl",
		controller : "serverListCtrl"
	}).when("/config/list/:serverId", {
		templateUrl : "/config/list.tpl",
		controller : "configListCtrl"
	}).when("/config/view/:serverId/:configType/:absolutePath", {
		templateUrl : "/config/view.tpl",
		controller : "configViewCtrl"
	}).when("/config/edit/:serverId/:configType/:absolutePath", {
		templateUrl : "/config/edit.tpl",
		controller : "configEditCtrl"
	}).when("/config/edit/result/:success", {
		templateUrl : "/config/edit.result.tpl",
		controller : "configEditResultCtrl"
	}).when("/user/signup", {
		templateUrl : "/user/signup"
	}).when("/user/signin", {
		templateUrl : "/user/signin"
	}).when("/help", {
		templateUrl : "/sys/help"
	}).otherwise("/server/list");
} ]);

/**
 * 禁止模板缓存  
 */
app.run(function($rootScope, $templateCache) {
    $rootScope.$on('$routeChangeStart', function(event, next, current) {  
        if (current && current["$$route"] && current["$$route"].uncached){  
            $templateCache.remove(current.templateUrl);  
        }  
    });  
}); 
